<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  
  <title>Hexo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta property="og:type" content="website">
<meta property="og:title" content="Hexo">
<meta property="og:url" content="http://example.com/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="John Doe">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">
  
  
    <link rel="shortcut icon" href="/favicon.png">
  
  
    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typeface-source-code-pro@0.0.71/index.min.css">

  
  
<link rel="stylesheet" href="/css/style.css">

  
    
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">

  
  
<meta name="generator" content="Hexo 6.3.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Hexo</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"><span class="fa fa-bars"></span></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
        
          <a class="nav-icon" href="/atom.xml" title="RSS Feed"><span class="fa fa-rss"></span></a>
        
        <a class="nav-icon nav-search-btn" title="Search"><span class="fa fa-search"></span></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://example.com"></form>
      </div>
    </div>
  </div>
</header>

      <div class="outer">
        <section id="main">
  
    <article id="post-png/RSCmdManual" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/png/RSCmdManual/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.759Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="RSCmd-Manual"><a href="#RSCmd-Manual" class="headerlink" title="RSCmd Manual"></a>RSCmd Manual</h1><h2 id="1-Introduction-RSCmd-and-Data"><a href="#1-Introduction-RSCmd-and-Data" class="headerlink" title="1. Introduction RSCmd and Data"></a>1. Introduction RSCmd and Data</h2><ul>
<li>RSCmd.rar</li>
</ul>
<blockquote>
<p>压缩包，包含着RSCmd.exe和数据test.hdr, test.img。</p>
</blockquote>
<ul>
<li>RSCmd.exe</li>
</ul>
<blockquote>
<p>可执行程序，即源代码编译链接后的输出结果。</p>
</blockquote>
<ul>
<li>test.hdr</li>
</ul>
<blockquote>
<p>图像元数据文件，描述图像数据的数据，是ASCII文件，用记事本(notepad)或Notepad++，EditPlus等工具打开即可看到相关内容。打开示意图如下：</p>
</blockquote>
<p><img src="/./hdr.png" alt="test_hdr"></p>
<ul>
<li>test.img</li>
</ul>
<blockquote>
<p>图像数据文件，图像二进制流，按照排列顺序，一个一个像素顺序排列的文件。</p>
</blockquote>
<h2 id="2-How-to-Execute-RSCmd"><a href="#2-How-to-Execute-RSCmd" class="headerlink" title="2. How to Execute RSCmd"></a>2. How to Execute RSCmd</h2><ul>
<li>Win+R - Windows图标+R</li>
</ul>
<p>弹出运行框，输入cmd，执行，弹出控制台窗口</p>
<p><img src="/./WinR.png" alt="WinR"></p>
<p><img src="/./Console.png" alt="Console"></p>
<ul>
<li>Execute RSCmd</li>
</ul>
<blockquote>
<p>输入如下的命令行，即可启动程序</p>
</blockquote>
<p><img src="/./RSCmd.png" alt="RSCmd"></p>
<ul>
<li>RSCmd.exe</li>
</ul>
<blockquote>
<p>程序界面如下：</p>
</blockquote>
<p><img src="/./RSCmdFace.png" alt="RSCmdFace"></p>
<h2 id="3-Command-Line"><a href="#3-Command-Line" class="headerlink" title="3. Command Line"></a>3. Command Line</h2><h3 id="3-1-Open"><a href="#3-1-Open" class="headerlink" title="3.1 Open"></a>3.1 Open</h3><ul>
<li>Open Command</li>
</ul>
<p><img src="/./Open.png" alt="Open"></p>
<h3 id="3-2-Statistics"><a href="#3-2-Statistics" class="headerlink" title="3.2 Statistics"></a>3.2 Statistics</h3><ul>
<li>Command Line</li>
</ul>
<p><img src="/./StatisticsCmd.png" alt="StatisticsCmd"></p>
<ul>
<li>Output</li>
</ul>
<p><img src="/./Statistics.png" alt="Statistics"></p>
<h3 id="3-3-Histogram"><a href="#3-3-Histogram" class="headerlink" title="3.3 Histogram"></a>3.3 Histogram</h3><ul>
<li>Command Line</li>
</ul>
<p><img src="/./HistogramCmd.png" alt="HistCmd"></p>
<ul>
<li>Output Histogram</li>
</ul>
<p><img src="/./Histogram.png" alt="Histogram"></p>
<h3 id="3-4-Display"><a href="#3-4-Display" class="headerlink" title="3.4 Display"></a>3.4 Display</h3><ul>
<li>Command Line</li>
</ul>
<p><img src="/./NormalCmd.png" alt="NormalDisp"></p>
<ul>
<li>Output Image:</li>
</ul>
<p><img src="/./Normal.png" alt="Normal"></p>
<ul>
<li>Linear Stretch</li>
</ul>
<p><img src="/./LinearDispCmd.png" alt="LinearDispCmd"></p>
<ul>
<li>Linear stretch Display</li>
</ul>
<p><img src="/./LinearDisp.png" alt="LinearDisp"></p>
<ul>
<li>Gray Display Command Line</li>
</ul>
<p><img src="/./GrayCmd.png" alt="GrayCmd"></p>
<ul>
<li>Output: Gray Display</li>
</ul>
<p><img src="/./Gray.png" alt="Gray"></p>
<ul>
<li><strong>试着改变波段组合，显示不同的伪彩色图像</strong></li>
</ul>
<h3 id="3-5-Filter"><a href="#3-5-Filter" class="headerlink" title="3.5 Filter"></a>3.5 Filter</h3><ul>
<li>Filter Command Line</li>
</ul>
<p><img src="/./MeanFilterCmd.png" alt="MeanFilterCmd"></p>
<ul>
<li>Image Filtered</li>
</ul>
<p><img src="/./MeanFilter3.png" alt="MeanFilter"></p>
<ul>
<li><p><strong>试着改变滤波核的大小，看看图像会有哪些变化。</strong></p>
</li>
<li><p>自定义滤波</p>
</li>
</ul>
<p><img src="/./FilterCmd.png" alt="FilterCmd"></p>
<ul>
<li>Image Filtered</li>
</ul>
<p><img src="/./FilterRes.png" alt="FilterRes"></p>
<ul>
<li><strong>自定义输入滤波核，观察图像的变化！</strong></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/png/RSCmdManual/" data-id="clij09mc00001c8n5dorkha1i" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/Subject" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/Subject/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.704Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="遥感图像处理程序"><a href="#遥感图像处理程序" class="headerlink" title="遥感图像处理程序"></a>遥感图像处理程序</h1><hr>
<h2 id="功能需求"><a href="#功能需求" class="headerlink" title="功能需求"></a>功能需求</h2><ol>
<li>编写一个遥感图像处理控制台程序，要求在控制台上输入字母菜单，执行相应的功能，详见<a href="./RSCmdManual.md"><strong>示例说明</strong></a>。</li>
<li>构建GUI界面程序完成相应的功能移植。</li>
<li>要求用类对象，实现主体功能。</li>
</ol>
<p>其功能项如下：</p>
<table>
<thead>
<tr>
<th align="center">序号</th>
<th align="left">功能菜单</th>
<th align="center">功能</th>
<th>备注</th>
</tr>
</thead>
<tbody><tr>
<td align="center">00</td>
<td align="left">X – Exit</td>
<td align="center">退出程序</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">01</td>
<td align="left">O – Open Image</td>
<td align="center">输入图像文件路径，即可读入文件数据</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">02</td>
<td align="left">I – Information</td>
<td align="center">输出当前图像的路径，行列值、波段数、数据类型、排列方式等</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">03</td>
<td align="left">C –Close Image</td>
<td align="center">关闭当前图像</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">04</td>
<td align="left">S – Statistics</td>
<td align="center">输出图像数据统计量，文件未打开，输出提示</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">05</td>
<td align="left">H – Histogram</td>
<td align="center">输出图像的直方图</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">06</td>
<td align="left">? – Help</td>
<td align="center">输出本信息</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">07</td>
<td align="left">A – Save as File</td>
<td align="center">输入保存的文件路径，输出图像为二进制文件</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">08</td>
<td align="left">Z – Zoom</td>
<td align="center">图像缩放，输入缩放比例尺，输出缩放图像</td>
<td><strong>必做</strong></td>
</tr>
<tr>
<td align="center">09</td>
<td align="left">R – Rotate Image</td>
<td align="center">图像旋转，输入旋转角度，逆时针旋转图像</td>
<td><em>选做</em></td>
</tr>
<tr>
<td align="center">10</td>
<td align="left">F - Filter</td>
<td align="center">输入滤波核，执行滤波，输出滤波后图像</td>
<td><em>选做</em></td>
</tr>
<tr>
<td align="center">11</td>
<td align="left">GUI</td>
<td align="center">使用界面库，如Qt等构建GUI程序，移植已有功能</td>
<td><em>选做</em></td>
</tr>
</tbody></table>
<h2 id="功能描述"><a href="#功能描述" class="headerlink" title="功能描述"></a>功能描述</h2><p>以下功能描述均在程序启动之后的描述。</p>
<h3 id="O-–-Open-Image"><a href="#O-–-Open-Image" class="headerlink" title="O – Open Image"></a><strong>O – Open Image</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>O</strong>或<strong>o</strong>，程序提示输入图像文件路径，回车后，读取指定图像文件。<br><strong>返回值：</strong>要求返回错误码，0-为读取成功。<br><strong>程序流程：</strong>1）读取图像文件头，得到行、列、波段数、排列方式、数据类型等信息；2）动态分配图像数据内存，文件IO读取二进制流。</p>
<h3 id="I-–-Information"><a href="#I-–-Information" class="headerlink" title="I – Information"></a><strong>I – Information</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>I</strong>或<strong>i</strong>，若图像已经打开，输出图像相关统计信息。<br><strong>返回值：</strong>错误则输出错误信息，成功则输出图像信息。<br><strong>程序流程：</strong>1）若图像文件打开，则输出图像路径行、列、波段数、排列方式、数据类型等信息到控制台。输出内容有：</p>
<blockquote>
<p>路径：c:\test.img<br>行： 400<br>列： 400<br>波段：6<br>…</p>
</blockquote>
<h3 id="C-–Close-Image"><a href="#C-–Close-Image" class="headerlink" title="C –Close Image"></a><strong>C –Close Image</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>C</strong>或<strong>c</strong>，关闭当前打开的文件。</p>
<p><strong>返回值：</strong>错误则返回错误信息，正确，返回0。</p>
<p><strong>程序流程：</strong>释放图像数据存储空间。</p>
<h3 id="X-–-Exit"><a href="#X-–-Exit" class="headerlink" title="X – Exit"></a><strong>X – Exit</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>X</strong>或<strong>x</strong>，程序退出。</p>
<p><strong>返回值：</strong>返回0。</p>
<p><strong>程序流程：</strong>释放所有对象，程序退出。</p>
<h3 id="？–-Help"><a href="#？–-Help" class="headerlink" title="？– Help"></a><strong>？– Help</strong></h3><p><strong>功能描述：</strong>在控制台输入字符**?**，程序输出菜单信息。</p>
<p><strong>返回值：</strong>返回0。</p>
<p><strong>程序流程：</strong>显示菜单信息。</p>
<h3 id="A-–-Save-as-File"><a href="#A-–-Save-as-File" class="headerlink" title="A – Save as File"></a><strong>A – Save as File</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>A</strong>或<strong>a</strong>，提示输入另存文件路径，写数据文件。</p>
<p><strong>返回值：</strong>错误-错误信息；正确-返回success。</p>
<p><strong>程序流程：</strong>1）写二进制流文件。</p>
<h3 id="S-–-Statistics"><a href="#S-–-Statistics" class="headerlink" title="S – Statistics"></a><strong>S – Statistics</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>S</strong>或<strong>s</strong>，输出当前图像文件的统计信息；图像文件未打开，则返回提示信息。</p>
<p><strong>返回值：</strong>错误-错误信息&#x2F;正确-返回success。</p>
<p><strong>程序流程：</strong>1）遍历图像数据；2）统计相关信息（均值、方差、最大值、最小值）</p>
<h3 id="H-–-Histogram"><a href="#H-–-Histogram" class="headerlink" title="H – Histogram"></a><strong>H – Histogram</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>H</strong>或<strong>h</strong>，输出当前图像的直方图信息；图像文件未打开，则返回提示信息。</p>
<p><strong>返回值：</strong>错误-错误信息&#x2F;正确-返回success。</p>
<p><strong>程序流程：</strong>1）遍历图像各个波段数据；2）统计直方图</p>
<h3 id="R-–-Rotate-Image"><a href="#R-–-Rotate-Image" class="headerlink" title="R – Rotate Image"></a><strong>R – Rotate Image</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>R</strong>或<strong>r</strong>，提示输入旋转角度（0-360°），将图像逆时针旋转指定角度。</p>
<p><strong>返回值：</strong>返回0。</p>
<p><strong>程序流程：</strong>1）输入旋转角度（0—360°）；2）旋转图像。</p>
<h3 id="Z-–-Zoom"><a href="#Z-–-Zoom" class="headerlink" title="Z – Zoom"></a><strong>Z – Zoom</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>Z</strong>或<strong>z</strong>，提示输入缩放比例，缩放图像。</p>
<p><strong>返回值：</strong>返回0。</p>
<p><strong>程序流程：</strong>1）输入缩放比例；2）执行图像缩放。 </p>
<h3 id="F-–-Filter"><a href="#F-–-Filter" class="headerlink" title="F – Filter"></a><strong>F – Filter</strong></h3><p><strong>功能描述：</strong>在控制台输入字符<strong>F</strong>或<strong>f</strong>，提示输入滤波核，执行图像卷积。</p>
<p><strong>返回值：</strong>返回0。</p>
<p><strong>程序流程：</strong>1）输入滤波核；2）执行图像卷积。</p>
<hr>
<p><a href="./README.md">Home</a> | <a href="#%E9%81%A5%E6%84%9F%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86%E7%A8%8B%E5%BA%8F">Head</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/Subject/" data-id="clij09mcb000fc8n59f2nhwyo" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/Statistics" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/Statistics/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.702Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="Day-4-统计信息显示"><a href="#Day-4-统计信息显示" class="headerlink" title="Day 4. 统计信息显示"></a>Day 4. 统计信息显示</h1><ol>
<li>统计每个波段的最大值、最小值、均值、方差、直方图以文本显示出来。</li>
<li>要求每个统计量均封装为函数。</li>
<li>输出的信息参考<a href="../../data/statistics.txt">ENVI统计输出</a></li>
</ol>
<hr>
<p>|<a href="Subject.md">Home</a> | <a href="#%E7%BB%9F%E8%AE%A1%E5%80%BC">Return</a>|</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/Statistics/" data-id="clij09mc8000ec8n5910mc7vl" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/RSImageFormat" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/RSImageFormat/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.701Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="RS-Image-Format"><a href="#RS-Image-Format" class="headerlink" title="RS Image Format"></a>RS Image Format</h1><h2 id="1-RS-Image"><a href="#1-RS-Image" class="headerlink" title="1. RS Image"></a>1. RS Image</h2><p>下图是一幅遥感图像显示的示例。图像窗口中，显示的图像是矩形区域，对应的数据为R-Band3， G-Band4， B-Band5，所以图像可以描述为三维矩阵（长*宽*高）。当图像逐步放大时，从右下方的Zoom窗口中可见，图像开始出现“马赛克”效应，即每一个像素点显示的够大，以至于像素间呈现了差异，这形象地揭示了图像和矩阵的联系。</p>
<p><img src="https://i.loli.net/2021/07/04/jwPr5FKSGAegkOf.png" alt="image-20210704093148250"></p>
<h2 id="2-RS-Image-File"><a href="#2-RS-Image-File" class="headerlink" title="2. RS Image  File"></a>2. RS Image  File</h2><p>既然多波段的遥感图像是三维矩阵，那么我们又是如何存储的呢？数据存储在外存（硬盘）上时，只有一种存储方式——顺序存储。下图是上图显示图像的数据存储文件。从左侧数据地址可知，数据是按字节依次存放的，从地址0x00000000开始，每一行存16个字节，第2行首地址即为：0x00000010，依此类推。</p>
<p><img src="https://i.loli.net/2021/07/04/8dVyBcmqbJEUuLR.png" alt="image-20210704101855309"></p>
<p>如果我们拿到上述的图像存储文件，我们能否将图像转变为三维矩阵呢？显然还不能，因为我们并不知道图像的长、宽、高以及每个像素存储的字节数（数据类型）。若要正确转换为矩阵，此时我们就需要借助一个对图像数据进行描述的文件，这种描述数据的数据，我们称之为<strong>元数据</strong>。对应其上的元数据文件如下所示：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">ENVI</span><br><span class="line">description = &#123;</span><br><span class="line">  Canon City, Colorado, Landsat TM, Calibrated to Reflectance &#125;</span><br><span class="line">samples = 640</span><br><span class="line">lines   = 400</span><br><span class="line">bands   = 6</span><br><span class="line">header offset = 0</span><br><span class="line">file type = ENVI Standard</span><br><span class="line">data type = 1</span><br><span class="line">interleave = bsq</span><br><span class="line">sensor type = Landsat TM</span><br><span class="line">wavelength units = Micrometers</span><br><span class="line">z plot range = &#123;0.00, 100.00&#125;</span><br><span class="line">z plot titles = &#123;Wavelength, Reflectance&#125;</span><br><span class="line">default stretch = 2.0% linear</span><br><span class="line">band names = &#123;</span><br><span class="line"> TM Band 1, TM Band 2, TM Band 3, TM Band 4, TM Band 5, TM Band 7&#125;</span><br><span class="line">wavelength = &#123;</span><br><span class="line"> 0.48500, 0.56000, 0.66000, 0.83000, 1.65000, 2.21500&#125;</span><br></pre></td></tr></table></figure>

<p>从元数据中，我们可以读取到samples - 列，lines - 行, bands &#x3D; 波段, data type - 数据类型，interleave-间隔方式等元数据。</p>
<h2 id="3-RS-Image-Format"><a href="#3-RS-Image-Format" class="headerlink" title="3. RS Image Format"></a>3. RS Image Format</h2><p>在三维矩阵写入到图像文件中时，根据数据间隔(interleave)方式不同，我们将数据分为按波段间隔-BSQ， 按行间隔-BIL和按点间隔-BIP，可以简单记为：点-BIP&#x2F;线-BIL&#x2F;面-BSQ。何为间隔方式呢，就是三维矩阵中的元素排列的方式，以三维数组A[i][j][k]为例，i-波段数bands，j-行数lines，k-列数samples，则：</p>
<ul>
<li><p>BSQ 排列顺序为：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">第<span class="number">1</span>个波段：A[<span class="number">0</span>][<span class="number">0</span>][<span class="number">0</span>],..., A[<span class="number">0</span>][lines<span class="number">-1</span>][samples<span class="number">-1</span>],</span><br><span class="line">第<span class="number">2</span>个波段：A[<span class="number">1</span>][<span class="number">0</span>][<span class="number">0</span>],..., A[<span class="number">1</span>][lines<span class="number">-1</span>][samples<span class="number">-1</span>],</span><br><span class="line">第.个波段：A[...][<span class="number">0</span>][<span class="number">0</span>],..., A[...][lines<span class="number">-1</span>][samples<span class="number">-1</span>],</span><br><span class="line">第b个波段：A[b<span class="number">-1</span>][<span class="number">0</span>][<span class="number">0</span>],..., A[b<span class="number">-1</span>][lines<span class="number">-1</span>][samples<span class="number">-1</span>]</span><br></pre></td></tr></table></figure>
</li>
<li><p>BIL 排列顺序为：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">第<span class="number">1</span>个波段第<span class="number">1</span>行：A[<span class="number">0</span>][<span class="number">0</span>][<span class="number">0</span>],..., A[<span class="number">0</span>][<span class="number">0</span>][samples<span class="number">-1</span>],</span><br><span class="line">...,</span><br><span class="line">第<span class="number">1</span>个波段第l行：A[<span class="number">0</span>][l<span class="number">-1</span>][<span class="number">0</span>],..., A[<span class="number">0</span>][l<span class="number">-1</span>][samples<span class="number">-1</span>],</span><br><span class="line">...,</span><br><span class="line"></span><br><span class="line">第<span class="number">2</span>个波段第<span class="number">1</span>行：A[<span class="number">1</span>][<span class="number">0</span>][<span class="number">0</span>],..., A[<span class="number">1</span>][<span class="number">0</span>][samples<span class="number">-1</span>],</span><br><span class="line">...,</span><br><span class="line">第<span class="number">2</span>个波段第l行：A[<span class="number">1</span>][l<span class="number">-1</span>][<span class="number">0</span>],..., A[<span class="number">1</span>][l<span class="number">-1</span>][samples<span class="number">-1</span>],</span><br><span class="line">...,</span><br><span class="line"></span><br><span class="line">第b个波段第<span class="number">1</span>行：A[b<span class="number">-1</span>][<span class="number">0</span>][<span class="number">0</span>],..., A[<span class="number">1</span>][<span class="number">0</span>][samples<span class="number">-1</span>],</span><br><span class="line">...,</span><br><span class="line">第b个波段第l行：A[b<span class="number">-1</span>][l<span class="number">-1</span>][<span class="number">0</span>],..., A[b<span class="number">-1</span>][l<span class="number">-1</span>][samples<span class="number">-1</span>]</span><br></pre></td></tr></table></figure>
</li>
<li><p>BIP 排列顺序为：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">第<span class="number">1</span>个波段第<span class="number">1</span>行第<span class="number">1</span>列：A[<span class="number">0</span>][<span class="number">0</span>][<span class="number">0</span>],</span><br><span class="line">...,</span><br><span class="line">第b个波段第<span class="number">1</span>行第<span class="number">1</span>列：A[b<span class="number">-1</span>][<span class="number">0</span>][<span class="number">0</span>],</span><br><span class="line">...,</span><br><span class="line"></span><br><span class="line">第<span class="number">1</span>个波段第<span class="number">1</span>行第<span class="number">2</span>列：A[<span class="number">0</span>][<span class="number">0</span>][<span class="number">1</span>],</span><br><span class="line">...,</span><br><span class="line">第b个波段第<span class="number">1</span>行第<span class="number">2</span>列：A[b<span class="number">-1</span>][<span class="number">0</span>][<span class="number">1</span>],</span><br><span class="line">...,</span><br><span class="line"></span><br><span class="line">第<span class="number">1</span>个波段第<span class="number">1</span>行第s列：A[<span class="number">0</span>][<span class="number">0</span>][s<span class="number">-1</span>],</span><br><span class="line">...,</span><br><span class="line">第b个波段第<span class="number">1</span>行第s列：A[b<span class="number">-1</span>][<span class="number">0</span>][s<span class="number">-1</span>],</span><br><span class="line"></span><br><span class="line">...,</span><br><span class="line">第<span class="number">1</span>个波段第<span class="number">2</span>行第<span class="number">1</span>列：A[<span class="number">0</span>][<span class="number">1</span>][<span class="number">0</span>],</span><br><span class="line">...,</span><br><span class="line">第b个波段第l行第s列：A[b<span class="number">-1</span>][l<span class="number">-1</span>][s<span class="number">-1</span>]</span><br></pre></td></tr></table></figure></li>
</ul>
<h2 id="4-Read-RS-Image-File-to-Image-Matrix"><a href="#4-Read-RS-Image-File-to-Image-Matrix" class="headerlink" title="4. Read RS Image File to Image Matrix"></a>4. Read RS Image File to Image Matrix</h2><p>在已知了samples, lines, bands, datatype, interleave之后，用程序来实现读取就变的比较容易了。</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//以数据类型为unsigned char为例</span></span><br><span class="line"><span class="comment">// 分配3维数组，存放图像文件</span></span><br><span class="line"><span class="type">unsigned</span> <span class="type">char</span>*** pImg = <span class="keyword">new</span> <span class="type">unsigned</span> <span class="type">char</span>**[nbands];</span><br><span class="line"><span class="keyword">for</span> (<span class="type">int</span> i=<span class="number">0</span>; i&lt;nbands; ++i)</span><br><span class="line">    pImg[i] = <span class="keyword">new</span> <span class="type">unsigned</span> <span class="type">char</span>* [nlines];</span><br><span class="line"></span><br><span class="line"><span class="keyword">for</span> (<span class="type">int</span> i=<span class="number">0</span>; i&lt;nbands; ++i)</span><br><span class="line">    <span class="keyword">for</span> (<span class="type">int</span> j=<span class="number">0</span>; j&lt;nlines; ++j)</span><br><span class="line">        pImg[i][j] = <span class="keyword">new</span> <span class="type">unsigned</span> <span class="type">char</span>[nsamples];</span><br><span class="line"></span><br><span class="line"><span class="function">ifstream	<span class="title">ifs</span><span class="params">(<span class="string">&quot;test.img&quot;</span>, ios::binary)</span></span>;</span><br><span class="line"><span class="comment">// BSQ读取</span></span><br><span class="line"><span class="keyword">for</span> (<span class="type">int</span> i=<span class="number">0</span>; i&lt;nbands; ++i)</span><br><span class="line">    <span class="keyword">for</span> (<span class="type">int</span> j=<span class="number">0</span>; j&lt;nlines; ++j)</span><br><span class="line">        ifs.<span class="built_in">read</span>(<span class="keyword">reinterpret_cast</span>&lt;<span class="type">char</span>*&gt;pImg[i][j], <span class="built_in">sizeof</span>(<span class="type">unsigned</span> <span class="type">char</span>)*nsamples);</span><br><span class="line"></span><br><span class="line"><span class="comment">//BIL读取</span></span><br><span class="line"><span class="keyword">for</span> (<span class="type">int</span> j=<span class="number">0</span>; j&lt;nlines; ++j)</span><br><span class="line">    <span class="keyword">for</span> (<span class="type">int</span> i=<span class="number">0</span>; i&lt;nbands; ++i)</span><br><span class="line">        ifs.<span class="built_in">read</span>(<span class="keyword">reinterpret_cast</span>&lt;<span class="type">char</span>*&gt;pImg[i][j], <span class="built_in">sizeof</span>(<span class="type">unsigned</span> <span class="type">char</span>)*nsamples);</span><br><span class="line"></span><br><span class="line"><span class="comment">//BIP读取</span></span><br><span class="line"><span class="keyword">for</span> (<span class="type">int</span> j=<span class="number">0</span>; j&lt;nlines; ++j)</span><br><span class="line">    <span class="keyword">for</span> (<span class="type">int</span> k=<span class="number">0</span>; k&lt;nsamples; ++k)</span><br><span class="line">        <span class="keyword">for</span> (<span class="type">int</span> i=<span class="number">0</span>; i&lt;nbands; ++i)</span><br><span class="line">            ifs.<span class="built_in">read</span>(<span class="keyword">reinterpret_cast</span>&lt;<span class="type">char</span>*&gt;&amp;pImg[i][j][k], <span class="built_in">sizeof</span>(<span class="type">unsigned</span> <span class="type">char</span>));</span><br><span class="line"></span><br><span class="line">ifs.<span class="built_in">close</span>();</span><br></pre></td></tr></table></figure>

<h2 id="5-Write-Image-Matrix-to-RS-Image-File"><a href="#5-Write-Image-Matrix-to-RS-Image-File" class="headerlink" title="5. Write Image Matrix to RS Image File"></a>5. Write Image Matrix to RS Image File</h2><p>写文件，与读文件类似。把<code>ifs.read() --&gt; ifs.write</code>即可。</p>
<h2 id="References"><a href="#References" class="headerlink" title="References"></a>References</h2>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/RSImageFormat/" data-id="clij09mc8000dc8n57wqgblpg" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/RSCmdManual" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/RSCmdManual/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.699Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="RSCmd-Manual"><a href="#RSCmd-Manual" class="headerlink" title="RSCmd Manual"></a>RSCmd Manual</h1><h1 id="lt-lt-lt-lt-lt-lt-lt-HEAD"><a href="#lt-lt-lt-lt-lt-lt-lt-HEAD" class="headerlink" title="&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD"></a>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD</h1><h2 id="0-操作视频"><a href="#0-操作视频" class="headerlink" title="0. 操作视频"></a>0. 操作视频</h2><ul>
<li><a href="../../videos/01.RSCmd_MainFrame.avi">01.MainFrame</a></li>
<li><a href="../../videos/02.RSCmd_OpenData.avi">02.OpenData</a></li>
<li><a href="02.RSCmd_2_Open.avi">02-1.Open</a></li>
<li><a href="03.RSCmd_Display.avi">03.Display</a></li>
</ul>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<p>b100a54beaa4bf406d7a4142f3f6914e85d940fe</p>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<h2 id="1-Introduction-RSCmd-and-Data"><a href="#1-Introduction-RSCmd-and-Data" class="headerlink" title="1. Introduction RSCmd and Data"></a>1. Introduction RSCmd and Data</h2><ul>
<li>RSCmd.rar</li>
</ul>
<blockquote>
<p>压缩包，包含着RSCmd.exe和数据test.hdr, test.img。</p>
</blockquote>
<ul>
<li>RSCmd.exe</li>
</ul>
<blockquote>
<p>可执行程序，即源代码编译链接后的输出结果。</p>
</blockquote>
<ul>
<li>test.hdr</li>
</ul>
<blockquote>
<p>图像元数据文件，描述图像数据的数据，是ASCII文件，用记事本(notepad)或Notepad++，EditPlus等工具打开即可看到相关内容。打开示意图如下：</p>
</blockquote>
<p><img src="/../../png/hdr.png" alt="test_hdr"></p>
<ul>
<li>test.img</li>
</ul>
<blockquote>
<p>图像数据文件，图像二进制流，按照排列顺序，一个一个像素顺序排列的文件。</p>
</blockquote>
<h2 id="2-How-to-Execute-RSCmd"><a href="#2-How-to-Execute-RSCmd" class="headerlink" title="2. How to Execute RSCmd"></a>2. How to Execute RSCmd</h2><ul>
<li>Win+R - Windows图标+R</li>
</ul>
<p>弹出运行框，输入cmd，执行，弹出控制台窗口</p>
<p><img src="/../../png/WinR.png" alt="WinR"></p>
<p><img src="/../../png/Console.png" alt="Console"></p>
<ul>
<li>Execute RSCmd</li>
</ul>
<blockquote>
<p>输入如下的命令行，即可启动程序</p>
</blockquote>
<p><img src="/../../png/RSCmd.png" alt="RSCmd"></p>
<ul>
<li>RSCmd.exe</li>
</ul>
<blockquote>
<p>程序界面如下：</p>
</blockquote>
<p><img src="/../../png/RSCmdFace.png" alt="RSCmdFace"></p>
<h2 id="3-Command-Line"><a href="#3-Command-Line" class="headerlink" title="3. Command Line"></a>3. Command Line</h2><h3 id="3-1-Open"><a href="#3-1-Open" class="headerlink" title="3.1 Open"></a>3.1 Open</h3><ul>
<li>Open Command</li>
</ul>
<p><img src="/../../png/Open.png" alt="Open"></p>
<h3 id="3-2-Statistics"><a href="#3-2-Statistics" class="headerlink" title="3.2 Statistics"></a>3.2 Statistics</h3><ul>
<li>Command Line</li>
</ul>
<p><img src="/../../png/StatisticsCmd.png" alt="StatisticsCmd"></p>
<ul>
<li>Output</li>
</ul>
<p><img src="/../../png/Statistics.png" alt="Statistics"></p>
<h3 id="3-3-Histogram"><a href="#3-3-Histogram" class="headerlink" title="3.3 Histogram"></a>3.3 Histogram</h3><ul>
<li>Command Line</li>
</ul>
<p><img src="/../../png/HistogramCmd.png" alt="HistCmd"></p>
<ul>
<li>Output Histogram</li>
</ul>
<p><img src="/../../png/Histogram.png" alt="Histogram"></p>
<h3 id="3-4-Display"><a href="#3-4-Display" class="headerlink" title="3.4 Display"></a>3.4 Display</h3><ul>
<li>Command Line</li>
</ul>
<p><img src="/../../png/NormalCmd.png" alt="NormalDisp"></p>
<ul>
<li>Output Image:</li>
</ul>
<p><img src="/../../png/Normal.png" alt="Normal"></p>
<ul>
<li>Linear Stretch</li>
</ul>
<p><img src="/../../png/LinearDispCmd.png" alt="LinearDispCmd"></p>
<ul>
<li>Linear stretch Display</li>
</ul>
<p><img src="/../../png/LinearDisp.png" alt="LinearDisp"></p>
<ul>
<li>Gray Display Command Line</li>
</ul>
<p><img src="/../../png/GrayCmd.png" alt="GrayCmd"></p>
<ul>
<li>Output: Gray Display</li>
</ul>
<p><img src="/../../png/Gray.png" alt="Gray"></p>
<ul>
<li><strong>试着改变波段组合，显示不同的伪彩色图像</strong></li>
</ul>
<h3 id="3-5-Filter"><a href="#3-5-Filter" class="headerlink" title="3.5 Filter"></a>3.5 Filter</h3><ul>
<li>Filter Command Line</li>
</ul>
<p><img src="/../../png/MeanFilterCmd.png" alt="MeanFilterCmd"></p>
<ul>
<li>Image Filtered</li>
</ul>
<p><img src="/../../png/MeanFilter3.png" alt="MeanFilter"></p>
<ul>
<li><p><strong>试着改变滤波核的大小，看看图像会有哪些变化。</strong></p>
</li>
<li><p>自定义滤波</p>
</li>
</ul>
<p><img src="/../../png/FilterCmd.png" alt="FilterCmd"></p>
<ul>
<li>Image Filtered</li>
</ul>
<p><img src="/../../png/FilterRes.png" alt="FilterRes"></p>
<ul>
<li><strong>自定义输入滤波核，观察图像的变化！</strong></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/RSCmdManual/" data-id="clij09mc7000cc8n5527h3iea" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/QtSetup" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/QtSetup/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.696Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="Qt-Setup"><a href="#Qt-Setup" class="headerlink" title="Qt Setup"></a>Qt Setup</h1><p>磨刀不误砍柴工，以下为开发前准备的相关工作。</p>
<h2 id="目录"><a href="#目录" class="headerlink" title="目录"></a>目录</h2><ul>
<li><a href="#0_Qt_Introduction">0. Qt Introduction</a></li>
<li><a href="#1_Qt_Setup">1. Qt Setup</a></li>
<li><a href="#2_Qt_Tutorials">2. Qt Tutorials</a></li>
<li><a href="#3_IDE">3. IDE</a></li>
</ul>
<h2 id="0-Qt-Introduction"><a href="#0-Qt-Introduction" class="headerlink" title="0. Qt Introduction"></a>0. Qt Introduction</h2><p>Qt 是 一个与 MFC 类似的开发框架，与MFC相比较而言，Qt 更为简便、易懂，而且跨操作系统。故而我们课设选择Qt库作为GUI框架。Qt 由C++开发而成，阅读Qt源代码，也是一个极佳的提高C++编程水平的机会。</p>
<h2 id="1-Qt-Setup"><a href="#1-Qt-Setup" class="headerlink" title="1. Qt Setup"></a>1. Qt Setup</h2><ul>
<li><p>Qt 安装包 <a target="_blank" rel="noopener" href="http://download.qt.io/archive/qt/5.10/5.10.1/qt-opensource-windows-x86-5.10.1.exe">Qt5.10.1下载</a><br>当然，你也可以选择其他适合自己的<a target="_blank" rel="noopener" href="http://download.qt.io/archive/qt">Qt历史版本</a></p>
</li>
<li><p>Qt安装安装步骤参照<a target="_blank" rel="noopener" href="https://blog.csdn.net/liang19890820/article/details/53931813#%E9%85%8D%E7%BD%AE-qt-creator">https://blog.csdn.net/liang19890820/article/details/53931813#%E9%85%8D%E7%BD%AE-qt-creator</a></p>
</li>
</ul>
<h2 id="2-Qt-Tutorials"><a href="#2-Qt-Tutorials" class="headerlink" title="2. Qt Tutorials"></a>2. Qt Tutorials</h2><p>Qt 的学习方式：</p>
<ul>
<li><p>以Qt Help 为主<br>QtCreator中提供了大量的示例工程，几乎每一类应用程序，都有样例程序。对于初学者，从样例程序开始，可以避免走弯路。</p>
</li>
<li><p>速查法<br>Qt 的内容极其庞大，在了解了Qt的基本框架之后，随用随查。参考：<a target="_blank" rel="noopener" href="https://blog.csdn.net/Louis_815/article/details/54286544">Qt 入门</a></p>
</li>
</ul>
<h2 id="3-IDE"><a href="#3-IDE" class="headerlink" title="3. IDE"></a>3. IDE</h2><p>Qt使用有2种，一种是QtCreator，一种是VS插件，这两种方式各有优劣。</p>
<ul>
<li><p>QtCreator的优势是轻便、开源免费；<br><a target="_blank" rel="noopener" href="https://blog.csdn.net/liang19890820/article/details/49894691">Set Qt MinGW</a></p>
</li>
<li><p>VS的优势是效率高，调试方便。具体设置见：<br><a target="_blank" rel="noopener" href="https://blog.csdn.net/liang19890820/article/details/49874033">Set Qt for VS</a></p>
</li>
<li><p>Qt VS. VS<br><a target="_blank" rel="noopener" href="https://blog.csdn.net/pianzang5201/article/details/79721623">Set Qt &amp; VS</a></p>
</li>
</ul>
<hr>
<p>|<a target="_blank" rel="noopener" href="https://cugwhp.github.io/OOPCPP/CourseDesign/CourseDesignNew.html#%E8%AF%BE%E8%AE%BE%E5%86%85%E5%AE%B9">Home</a>  | <a href="#%E7%9B%AE%E5%BD%95">Return</a> | <a href="./D1_Frame.md">Next</a> |</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/QtSetup/" data-id="clij09mc7000bc8n57n9d42p3" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/openCV" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/openCV/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.695Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="Compile-OpenCV"><a href="#Compile-OpenCV" class="headerlink" title="Compile OpenCV"></a>Compile OpenCV</h1><h2 id="Install-OpenCV"><a href="#Install-OpenCV" class="headerlink" title="Install OpenCV"></a>Install OpenCV</h2><p><a target="_blank" rel="noopener" href="https://www.kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw">openCV-minGW</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/openCV/" data-id="clij09mcd000gc8n51ydo7ui1" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/Information" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/Information/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.690Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="Day-3-Image-Information"><a href="#Day-3-Image-Information" class="headerlink" title="Day 3 - Image Information"></a>Day 3 - Image Information</h1><blockquote>
<p>在控制台显示图像的基本信息。</p>
</blockquote>
<p>[TOC]</p>
<h2 id="功能"><a href="#功能" class="headerlink" title="功能"></a>功能</h2><ol>
<li>了解图像的基本信息包括哪些？</li>
<li>格式化输出相应的信息，可以参考ENVI等相关的商用软件<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">ENVI</span><br><span class="line">description = &#123;</span><br><span class="line">  Canon City, Colorado, Landsat TM, Calibrated to Reflectance &#125;</span><br><span class="line">samples = 640</span><br><span class="line">lines   = 400</span><br><span class="line">bands   = 6</span><br><span class="line">header offset = 0</span><br><span class="line">file type = ENVI Standard</span><br><span class="line">data type = 1</span><br><span class="line">interleave = bsq</span><br><span class="line">sensor type = Landsat TM</span><br><span class="line">wavelength units = Micrometers</span><br><span class="line">z plot range = &#123;0.00, 100.00&#125;</span><br><span class="line">z plot titles = &#123;Wavelength, Reflectance&#125;</span><br><span class="line">default stretch = 2.0% linear</span><br><span class="line">band names = &#123;</span><br><span class="line"> TM Band 1, TM Band 2, TM Band 3, TM Band 4, TM Band 5, TM Band 7&#125;</span><br><span class="line">wavelength = &#123;</span><br><span class="line"> 0.48500, 0.56000, 0.66000, 0.83000, 1.65000, 2.21500&#125;</span><br></pre></td></tr></table></figure></li>
</ol>
<p>Go To <a href="./Subject.md">课设题目</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/Information/" data-id="clij09mc6000ac8n5c04ohrlu" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/Filter" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/Filter/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.684Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="Day-7-图像空间域滤波"><a href="#Day-7-图像空间域滤波" class="headerlink" title="Day 7. 图像空间域滤波"></a>Day 7. 图像空间域滤波</h1><p>图像空间域滤波是一种邻域算子，通过对某个像素点一定范围内的邻域点（如：3<em>3,5</em>5）作用某种算子，得到一幅新的图像。</p>
<p>根据作用的算子不同，可以分为平滑滤波和边缘增强滤波。平滑滤波顾名思义，就是将图像的细节部分弱化，得到的图像更为模糊，最常用的算子有均值滤波。<br>边缘增强算子正好相反，是突出图像中的边缘部分，增强细节。</p>
<p>空域滤波的运算过程并不复杂，比如滤波算子是3<em>3的矩阵，将3</em>3的窗口在图像的每个像元中滑动（中心对齐某个像元），卷积求和的方法得到新的像素值即为滤波后的图像。<br>具体细节，参考下列资料。</p>
<ul>
<li><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/50238655">参考资料</a></li>
</ul>
<hr>
<p>|<a href="Subject.md">Home</a> |</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/Filter/" data-id="clij09mc50009c8n5fia4e41r" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-docs/RSImage/Display_EasyX" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2023/06/05/docs/RSImage/Display_EasyX/" class="article-date">
  <time class="dt-published" datetime="2023-06-05T15:25:53.681Z" itemprop="datePublished">2023-06-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h1 id="Day-5-EasyX显示图像的基本步骤"><a href="#Day-5-EasyX显示图像的基本步骤" class="headerlink" title="Day 5. EasyX显示图像的基本步骤"></a>Day 5. EasyX显示图像的基本步骤</h1><blockquote>
<p>全部代码在main.cpp中完成</p>
</blockquote>
<h2 id="0-安装EasyX库"><a href="#0-安装EasyX库" class="headerlink" title="0. 安装EasyX库"></a>0. 安装EasyX库</h2><p>从<a target="_blank" rel="noopener" href="http://easyx.cn/">EasyX</a>下载EasyX安装程序，安装即可。</p>
<h2 id="1-增加头文件"><a href="#1-增加头文件" class="headerlink" title="1. 增加头文件"></a>1. 增加头文件</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">include &lt;graphics.h&gt;	<span class="comment">//使用EasyX图形绘制和IMAGE对象</span></span><br></pre></td></tr></table></figure>

<h2 id="2-增加前向声明"><a href="#2-增加前向声明" class="headerlink" title="2. 增加前向声明"></a>2. 增加前向声明</h2><p>&#x2F;&#x2F; 前向声明，显示图像<br>void DisplayImage(CRSImage* pRSImg);</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">## 3. 实现 DisplayImage函数</span><br><span class="line">```c++</span><br><span class="line">//////////////////////////////////////////////////////////////////////////</span><br><span class="line">// DisplayImage - 显示图像到控制台窗口									//</span><br><span class="line">// CRSImage* pRSImg - 图像数据指针										//</span><br><span class="line">// 返回值 - void														//</span><br><span class="line">//////////////////////////////////////////////////////////////////////////</span><br><span class="line">void DisplayImage(CRSImage* pRSImg)</span><br><span class="line">&#123;</span><br><span class="line">	// 参数判断</span><br><span class="line">	if (pRSImg==NULL)</span><br><span class="line">		return;</span><br><span class="line">	</span><br><span class="line">        initgraph(m_nSamples, m_nLines);</span><br><span class="line"></span><br><span class="line">	int		i, j;	</span><br><span class="line">	int		nBands = pRSImg-&gt;GetBands();		//波段</span><br><span class="line">	int		nSamples = pRSImg-&gt;GetSamples();	//列</span><br><span class="line">	int		nLines = pRSImg-&gt;GetLines();		//行</span><br><span class="line">	unsigned char***	pppData = pRSImg-&gt;GetDataBuffer();	//三维数组头指针</span><br><span class="line">	unsigned char**		ppRed = pppData[0];		//红色通道的波段</span><br><span class="line">	unsigned char**		ppGrn = nBands&gt;2 ? pppData[1] : pppData[0];	//绿色通道的波段</span><br><span class="line">	unsigned char**		ppBlu = nBands&gt;2 ? pppData[2] : pppData[0];	//蓝色通道的波段</span><br><span class="line"></span><br><span class="line">        // 创建EasyX IMAGE对象</span><br><span class="line">	IMAGE	img(m_nSamples, m_nLines);</span><br><span class="line">	DWORD*	pImgBuffer = GetImageBuffer(&amp;img);</span><br><span class="line"></span><br><span class="line">	// 遍历像素，显示图像</span><br><span class="line">	for (i = 0; i &lt; m_nLines; i++)</span><br><span class="line">	&#123;</span><br><span class="line">		for (j = 0; j &lt; m_nSamples; j++)</span><br><span class="line">		&#123;</span><br><span class="line">			pImgBuffer[i*m_nSamples + j] = RGB(m_pppData[nRedBand][i][j], m_pppData[nGrnBand][i][j],</span><br><span class="line">				m_pppData[nBluBand][i][j]);</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	// 绘制影像</span><br><span class="line">	putimage(0, 0, &amp;img);</span><br><span class="line"></span><br><span class="line">	// 等待用户按 ESC，退出显示窗口</span><br><span class="line">	while (!_kbhit())</span><br><span class="line">	&#123;</span><br><span class="line">		if (_getch() == 27)</span><br><span class="line">			break;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	// 关闭绘制窗体</span><br><span class="line">	closegraph();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="4-调用Display函数"><a href="#4-调用Display函数" class="headerlink" title="4. 调用Display函数"></a>4. 调用Display函数</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 在图像文件打开之后，就可以调用图像显示</span></span><br><span class="line">...</span><br><span class="line">  <span class="keyword">case</span> <span class="string">&#x27;O&#x27;</span>:</span><br><span class="line">	...</span><br><span class="line">	rsImg.<span class="built_in">Open</span>(...);</span><br><span class="line">	<span class="keyword">if</span> (rsImg.<span class="built_in">IsOpen</span>())</span><br><span class="line">		<span class="built_in">DisplayImage</span>(&amp;rsImg);</span><br><span class="line">	<span class="keyword">break</span>;</span><br></pre></td></tr></table></figure>
<p>你若有兴趣，可以修改DisplayImage的接口，实现图像的定制化显示，如：波段组合等。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2023/06/05/docs/RSImage/Display_EasyX/" data-id="clij09mc40008c8n5h6gme5e0" data-title="" class="article-share-link"><span class="fa fa-share">Share</span></a>
      
      
      
    </footer>
  </div>
  
</article>



  


  <nav id="page-nav">
    
    <span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="extend next" rel="next" href="/page/2/">Next &raquo;</a>
  </nav>

</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/06/">June 2023</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2023/06/05/png/RSCmdManual/">(no title)</a>
          </li>
        
          <li>
            <a href="/2023/06/05/docs/RSImage/Subject/">(no title)</a>
          </li>
        
          <li>
            <a href="/2023/06/05/docs/RSImage/Statistics/">(no title)</a>
          </li>
        
          <li>
            <a href="/2023/06/05/docs/RSImage/RSImageFormat/">(no title)</a>
          </li>
        
          <li>
            <a href="/2023/06/05/docs/RSImage/RSCmdManual/">(no title)</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      
      &copy; 2023 John Doe<br>
      Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    


<script src="/js/jquery-3.6.4.min.js"></script>



  
<script src="/fancybox/jquery.fancybox.min.js"></script>




<script src="/js/script.js"></script>





  </div>
</body>
</html>